package com.retail.bbq.cola.controller;

import com.retail.bbq.cola.enums.TicketStatusEnum;
import com.retail.bbq.cola.service.CustomerAgreementInfoService;
import com.retail.bbq.cola.vo.ResultVO;
import com.retail.bbq.cola.vo.request.CustomerAgreementRequest;
import com.retail.bbq.cola.vo.request.UpdateTicketRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/customer-agreement")
@Slf4j
public class CustomerAgreementController {

    @Resource
    private CustomerAgreementInfoService customerAgreementInfoService;

    @RequestMapping("/agreement")
    public ResultVO<?> agreement(@RequestBody CustomerAgreementRequest request) {
        return customerAgreementInfoService.agreement(request);
    }

    @RequestMapping("/query")
    public ResultVO<?> queryAgreement(@RequestBody CustomerAgreementRequest request) {
        return customerAgreementInfoService.queryAgreement(request);
    }

    /**
     * 更新领券成功
     * @return
     */
    @RequestMapping("/updateTicketSuccess")
    public ResultVO<?> updateTicket(@RequestBody CustomerAgreementRequest request) {
        return ResultVO.succ(customerAgreementInfoService.updateTicket(request, TicketStatusEnum.SUCC));
    }
}
